package reflect;

import reflect.annotation.AutoRunClass;
import reflect.annotation.AutoRunMethod;

@AutoRunClass
public class Person {
    private String name;
    private int age;

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{name = " + name + ", age = " + age + "}";
    }

    public void sayHello() {
        System.out.println(name + ": hello!");
    }

    @AutoRunMethod
    public void sayHi() {
        System.out.println(name + ": hi!");
    }

    public void say(String info, int count) {
        for (int i = 0; i < count; i++) {
            System.out.println(info + ": hello!");
        }
    }
}
